<?php

class mdlUser extends Zend_Db_Table_Abstract
{

    protected $_name = 'mdl_user';
    protected $_schema = 'moodle';
    protected $_rowClass = 'row_mdlUser';
    protected $_dependentTable = array('mdlRoleAssignments');
  
    public function getbyUsername($username){
        $where = $this->getAdapter()->quoteInto('username=?', $username);
        $row = $this->fetchRow($where);
        if (!$row) {
            throw new Exception("Username não encontrado: $username");
        }
        return $row;
    }
}